home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / xdistfile.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  80 lines

  1. ; $Id: xdistfile.pro,v 1.6 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1994-1997, Research Systems, Inc.  All rights reserved.
  4. ;    Unauthorized reproduction prohibited.
  5.  
  6. PRO XDistfile, FILENAME, SUBDIRECTORY, _EXTRA=extra
  7. ;+
  8. ; NAME: 
  9. ;    XDISTFILE
  10. ;
  11. ; PURPOSE:
  12. ;    Displays ASCII text files from the IDL distribution. Unlike
  13. ;    XDISPLAYFILE, this routine understands that under VMS, IDL
  14. ;    routines are packed in VMS text libraries.
  15. ;
  16. ; CATEGORY:
  17. ;    Widgets.
  18. ;
  19. ; CALLING SEQUENCE:
  20. ;    XDISTFILE, Filename, Subdirectory
  21. ;
  22. ; INPUTS:
  23. ;     Filename:    A scalar string that contains the filename of the file
  24. ;        to display NOT INCLUDING the '.pro' extension or any
  25. ;        path information.
  26. ;     Subdirectory: Subdirectory information in the style of the
  27. ;        FILEPATH user library routine.
  28. ;
  29. ; KEYWORD PARAMETERS:
  30. ;    Any keywords allowed by XDISPLAYFILE are also allowed.
  31. ;
  32. ; OUTPUTS:
  33. ;    No explicit outputs.  A file viewing widget is created.
  34. ;
  35. ; SIDE EFFECTS:
  36. ;    Triggers the XMANAGER if it is not already in use.
  37. ;
  38. ; RESTRICTIONS:
  39. ;    None.
  40. ;
  41. ; PROCEDURE:
  42. ;    This is a thin wrapper over the XDISPLAYFILE routine.
  43. ;    In the case of VMS text libraries, the last element of the
  44. ;    SUBDIRECTORY argument is taken to be the TLB file name, and
  45. ;    FILENAME is actually the module name in that library.
  46. ;
  47. ; MODIFICATION HISTORY:
  48. ;    1 June 1994, AB
  49. ;-
  50.  
  51.   if (!version.os eq 'vms') then begin
  52.     n = n_elements(subdirectory)
  53.     subn = n
  54.     if (subn lt 1) then message,'SUBDIRECTORY doesn''t contain enough elements.'
  55.  
  56.     module = subdirectory[n-1]
  57.     subd = subdirectory[0:n-subn]
  58.     n=n-1
  59.  
  60.     library=filepath(module+'.tlb', SUBDIRECTORY=subd)
  61.     ;
  62.     ; WARNING:
  63.     ;
  64.     ;    READ_VMSTLB is undocumented and likely to disappear or change
  65.     ;   radiacally in future IDL releases. Use at your own risk.
  66.     ;
  67.     text = READ_VMSTLB(library, filename, count=c)
  68.     if (c ne 0) then begin
  69.       title = library + '  (' + STRUPCASE(filename) + '.PRO)'
  70.       XDISPLAYFILE, TEXT=TEXT, title=title, _extra=extra
  71.       return
  72.     endif
  73.   endif
  74.  
  75.  
  76.   XDISPLAYFILE, FILEPATH(filename + '.pro', SUBDIRECTORY=SUBDIRECTORY), $
  77.              _extra=extra
  78.  
  79. END
  80.